<template>
  <div>
    <el-button @click="handleGoods">转存数据</el-button>
  </div>
</template>

<script>
import axios from "axios";
import { proBatch } from "../../api/product";
export default {
  methods: {
    async handleGoods() {
      console.log(1);
      // 1. 请求第三方服务器，获取其数据包
      let url = `http://121.89.205.189:3000/admin/pro/list?count=1`;
      let res1 = await axios({
        url,
        headers: {
          token:
            "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbm5hbWUiOiJhZG1pbiIsImlhdCI6MTY3MTY3MTczMSwiZXhwIjoxNjcxNzAwNTMxfQ.s3SVLDQw_SxOIP3x6QGZQygPw7FpAEma5f2uOui9S4Q",
        },
      });
      console.log(res1);
      // 2. 将数据包批量转存至LeanCloud
      let res2 = await proBatch(res1.data.data);
    },
  },
};
</script>

<style lang="scss" scoped></style>
